﻿<%@ Page Language="C#" MasterPageFile="~/MasterPageSERIX.Master" AutoEventWireup="True"
    CodeBehind="Programacao.aspx.cs" Inherits="SERIX.Programacao" Title="Untitled Page" %>

<%@ Register Src="Controles/Navegador.ascx" TagName="Navegador" TagPrefix="uc1" %>
<%@ Register Src="Controles/lovGenerica.ascx" TagName="lovGenerica" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table width="97%" border="0" cellspacing="0" cellpadding="2" align="center">
        <tr>
            <td class="secao_titulo" style="width: 284px">
                Programação<hr class="linhaHorizontal" style="width: 740px" />
            </td>
        </tr>
    </table>
    <asp:UpdatePanel ID="UpdatePanelFiltro" runat="server">
        <ContentTemplate>
            <table border="0" cellpadding="2" cellspacing="0" width="97%">
                <tr>
                    <td class="grid_titulo" style="text-align: left">
                        <label>
                            <span style="color: #FFFFFF">Ano:</span>
                            <br />
                            <asp:DropDownList ID="ddlAno" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlAno_SelectedIndexChanged">
                            </asp:DropDownList>
                        </label>
                    </td>
                    <td class="grid_titulo" style="text-align: left">
                        <span style="color: #FFFFFF">Municipios:</span>
                        <br />
                        <asp:DropDownList runat="server" ID="ddlMunicipios" DataSourceID="odsMunicipios"
                            DataTextField="NOME_MUN" DataValueField="IDT_MUN" AutoPostBack="True" 
                            OnSelectedIndexChanged="ddlMunicipios_SelectedIndexChanged" 
                            AppendDataBoundItems="True" ondatabinding="ddlMunicipios_DataBinding">
                        </asp:DropDownList>
                        <asp:ObjectDataSource ID="odsMunicipios" runat="server" TypeName="SERIX.Classes.CProgramacao"
                            OldValuesParameterFormatString="original_{0}" OnSelecting="odsMunicipios_Selecting1"
                            SelectMethod="ObterMunicipios">
                            <SelectParameters>
                                <asp:Parameter Name="idt_Tec" Type="Int32" />
                                <asp:Parameter Name="login" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                    </td>
                </tr>
                <tr>
                    <td class="grid_titulo" style="text-align: left">
                        <span style="color: #FFFFFF">Programa: </span>
                        <br />
                        <asp:DropDownList runat="server" ID="ddlPrograma" AutoPostBack="True" 
                            DataSourceID="odsPrograma" DataTextField="NOM_PROG" DataValueField="idt_prog" 
                            onselectedindexchanged="ddlPrograma_SelectedIndexChanged"></asp:DropDownList>
                        <asp:ObjectDataSource runat="server" ID="odsPrograma" 
                            OldValuesParameterFormatString="original_{0}" 
                            onselecting="odsPrograma_Selecting" SelectMethod="ObterProgramas" 
                            TypeName="SERIX.Classes.CProgramacao">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="ddlAno" Name="ano_AIS" 
                                    PropertyName="SelectedValue" Type="String" />
                                <asp:ControlParameter ControlID="ddlMunicipios" Name="idt_Mun" 
                                    PropertyName="SelectedValue" Type="String" />
                                <asp:Parameter Name="login" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                    </td>
                    <td class="grid_titulo" style="text-align: left">
                        <span style="color: #FFFFFF">Ação:</span>
                        <br />
                        <asp:DropDownList runat="server" ID="ddlAcao" DataSourceID="odsAcao" DataTextField="DSC_ACAO"
                            DataValueField="IDT_ACAO" AutoPostBack="True" OnSelectedIndexChanged="ddlAcao_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:ObjectDataSource ID="odsAcao" runat="server" OnSelecting="odsAcao_Selecting"
                            SelectMethod="ObterAcoesPrograma" TypeName="SERIX.CAcoesProgramas" OldValuesParameterFormatString="original_{0}">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="ddlPrograma" Name="idt_prog" 
                                    PropertyName="SelectedValue" Type="String" />
                                <asp:ControlParameter ControlID="ddlAno" Name="ano_ais" PropertyName="Text" Type="String" />
                                <asp:Parameter Name="login" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                    </td>
                </tr>
            </table>
            <asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" CssClass="grid"
                OnRowDataBound="gridView_RowDataBound" EmptyDataText="Nenhum registro encontrado."
                DataKeyNames="idt_AIS,idt_ind,Idt_Tpo_Med,Idt_Tpo_Med2,Idt_Tpo_Med3" 
                DataSourceID="odsIndicadores">
                <AlternatingRowStyle CssClass="row_alter" />
                <Columns>
                    <asp:BoundField DataField="dsc_IND" HeaderText="Indicador" 
                        ItemStyle-Width="320px">
                        <ItemStyle Width="320px"></ItemStyle>
                    </asp:BoundField>
                    <asp:TemplateField>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Unidade 1
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Medida1" runat="server"></asp:Label>
                            <asp:TextBox ID="Valor1" runat="server"></asp:TextBox>
                        </ItemTemplate>
                        <HeaderStyle Width="100px" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Unidade 2
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Medida2" runat="server"></asp:Label>
                            <asp:TextBox ID="Valor2" runat="server"></asp:TextBox>
                        </ItemTemplate>
                        <HeaderStyle Width="100px" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Unidade 3
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Medida3" runat="server"></asp:Label>
                            <asp:TextBox ID="Valor3" runat="server"></asp:TextBox>
                        </ItemTemplate>
                        <HeaderStyle Width="100px" />
                    </asp:TemplateField>
                </Columns>
                <EmptyDataRowStyle CssClass="emptyrow" />
                <FooterStyle CssClass="footer" />
                <HeaderStyle CssClass="header" />
                <PagerStyle CssClass="pager" />
                <RowStyle CssClass="row" />
            </asp:GridView>
            <div style="text-align: right">
                <asp:Button ID="btnConfirmar" runat="server" Font-Bold="True" Text="Confirmar"
                    Width="78px" OnClick="btnConfirmar_Click" />
                <br />
                <asp:Label ID="lblmsg" runat="server" CssClass="label_verde" TabIndex="-1" Visible="False"
                    Width="740px"></asp:Label>
            </div>
            <asp:ObjectDataSource ID="odsIndicadores" runat="server" OnSelecting="odsIndicadores_Selecting1"
                SelectMethod="ObterProgramacao" TypeName="SERIX.Classes.CProgramacao" OnSelected="odsIndicadores_Selected"
                OldValuesParameterFormatString="original_{0}">
                <SelectParameters>
                    <asp:Parameter Name="IDT_PROG" Type="String" />
                    <asp:ControlParameter ControlID="ddlAno" Name="ano_Ais" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:ControlParameter ControlID="ddlMunicipios" Name="idt_Mun" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:ControlParameter ControlID="ddlAcao" Name="idt_Acao" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:Parameter Name="idt_tec" Type="String" />
                    <asp:Parameter Name="login" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
